///*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
//package com.feiyue;
//
//import android.app.Activity;
//import android.content.Context;
//import android.content.Intent;
//import android.os.Bundle;
//import android.os.Handler;
//import android.view.View;
//import android.widget.AbsListView;
//import android.widget.AbsListView.OnScrollListener;
//import android.widget.AdapterView;
//import android.widget.AdapterView.OnItemClickListener;
//import android.widget.LinearLayout;
//import android.widget.ListView;
//import android.widget.RelativeLayout;
//import android.widget.Toast;
//import com.feiyue.basic.server.net.NovelInfo;
//import com.feiyue.basic.server.parser.Book;
//import com.feiyue.helper.BookListAdapter;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//
//public class BookRecommendationActivity extends Activity implements
//		AbsListView.OnScrollListener {
//	private List<Book> booklist;
//	private String categoryname = "";
//	private Context context;
//	private Handler handler;
//	private boolean hasmore = true;
//	private RelativeLayout header;
//	private int lastbottom = -1;
//	public int lastindex = 0;
//	private ListView list;
//	private ArrayList<HashMap<String, Object>> listItem;
//	public BookListAdapter listItemAdapter;
//	private LinearLayout list_linear;
//	public List<Book> localbooklist;
//	private LinearLayout morebooks;
//	private Myrunnable myrunnable;
//	public boolean thread2getnewbookisrunning = false;
//
//	public void load() {
//		this.booklist.addAll(this.localbooklist);
//		int i = this.localbooklist.size();
//		for (int j = 0;; ++j) {
//			if (j >= i) {
//				this.listItemAdapter.notifyDataSetChanged();
//				this.morebooks.setVisibility(8);
//				this.list_linear.setVisibility(0);
//				return;
//			}
//			HashMap localHashMap = new HashMap();
//			localHashMap.put("ItemTile",
//					((Book) this.localbooklist.get(j)).getName());
//			localHashMap.put("ItemAuthor",
//					"作者:" + ((Book) this.localbooklist.get(j)).getAuthor());
//			localHashMap.put("ItemIntroduction", "介绍:"
//					+ ((Book) this.localbooklist.get(j)).getIntroduction());
//			this.listItem.add(localHashMap);
//		}
//	}
//
//	public void max() {
//		int i = this.localbooklist.size();
//		for (int j = 0;; ++j) {
//			if (j >= i)
//				return;
//			if (((Book) this.localbooklist.get(j)).getId() <= this.lastindex)
//				continue;
//			this.lastindex = ((Book) this.localbooklist.get(j)).getId();
//		}
//	}
//
//	public void onCreate(Bundle paramBundle) {
//		super.onCreate(paramBundle);
//		setContentView(2130903042);
//		this.context = getApplicationContext();
//		this.morebooks = ((LinearLayout) findViewById(2131099690));
//		this.header = ((RelativeLayout) findViewById(2131099685));
//		this.list_linear = ((LinearLayout) findViewById(2131099688));
//		this.list = ((ListView) findViewById(2131099689));
//		this.list.setOnScrollListener(this);
//		this.morebooks.setVisibility(0);
//		this.header.setVisibility(8);
//		this.list_linear.setVisibility(8);
//		this.myrunnable = new Myrunnable(null);
//		this.handler = new Handler();
//		this.booklist = new ArrayList();
//		this.localbooklist = new ArrayList();
//		this.listItem = new ArrayList();
//		this.listItemAdapter = new BookListAdapter(this.context, this.listItem,
//				2130903043, new String[] { "ItemTile", "ItemAuthor",
//						"ItemIntroduction" }, new int[] { 2131099695,
//						2131099696, 2131099697 }, this.booklist);
//		this.list.setAdapter(this.listItemAdapter);
//		this.list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
//			public void onItemClick(AdapterView<?> paramAdapterView,
//					View paramView, int paramInt, long paramLong) {
//				BookRecommendationActivity.this.setTitle("点击第" + paramInt
//						+ "个项目");
//				String str1 = ((Book) BookRecommendationActivity.this.booklist
//						.get(paramInt)).getName();
//				int i = ((Book) BookRecommendationActivity.this.booklist
//						.get(paramInt)).getId();
//				int j = ((Book) BookRecommendationActivity.this.booklist
//						.get(paramInt)).getCoverid();
//				String str2 = ((Book) BookRecommendationActivity.this.booklist
//						.get(paramInt)).getCoverAddr();
//				int k = ((Book) BookRecommendationActivity.this.booklist
//						.get(paramInt)).getdlstate();
//				String str3 = ((Book) BookRecommendationActivity.this.booklist
//						.get(paramInt)).getAuthor();
//				String str4 = ((Book) BookRecommendationActivity.this.booklist
//						.get(paramInt)).getIntroduction();
//				String str5 = ((Book) BookRecommendationActivity.this.booklist
//						.get(paramInt)).getIssuestate();
//				Intent localIntent = new Intent(BookRecommendationActivity.this
//						.getApplicationContext(), BookBriefActivity.class);
//				localIntent.putExtra("categoryname",
//						BookRecommendationActivity.this.categoryname);
//				localIntent.putExtra("categoryid", 1);
//				localIntent.putExtra("bookname", str1);
//				localIntent.putExtra("bookid", i);
//				localIntent.putExtra("author", str3);
//				localIntent.putExtra("introduction", str4);
//				localIntent.putExtra("issuestate", str5);
//				localIntent.putExtra("coverid", j);
//				localIntent.putExtra("coverAddr", str2);
//				localIntent.putExtra("dlstate", k);
//				BookRecommendationActivity.this.startActivity(localIntent);
//			}
//		});
//		this.thread2getnewbookisrunning = true;
//		new MyThread(null).start();
//	}
//
//	protected void onDestroy() {
//		super.onDestroy();
//	}
//
//	public void onScroll(AbsListView paramAbsListView, int paramInt1,
//			int paramInt2, int paramInt3) {
//		if (this.lastbottom == paramInt1 + paramInt2)
//			;
//		do {
//			return;
//			this.lastbottom = (paramInt1 + paramInt2);
//			if ((paramInt1 + paramInt2 != paramInt3) || (paramInt3 == 0))
//				break label64;
//			this.morebooks.setVisibility(0);
//		} while (this.thread2getnewbookisrunning);
//		this.thread2getnewbookisrunning = true;
//		new MyThread(null).start();
//		return;
//		label64: this.morebooks.setVisibility(8);
//	}
//
//	public void onScrollStateChanged(AbsListView paramAbsListView, int paramInt) {
//	}
//
//	private class MyThread extends Thread {
//		public void run()
//    {
//      if ((BookRecommendationActivity.this.localbooklist != null) && (BookRecommendationActivity.this.localbooklist.size() != 0))
//        BookRecommendationActivity.this.max();
//      if (BookRecommendationActivity.this.hasmore)
//      {
//        BookRecommendationActivity.this.localbooklist = NovelInfo.getNewestBookList(BookRecommendationActivity.this.context, NovelInfo.getUrl2newestBooklist(BookRecommendationActivity.this.lastindex, 10));
//        if ((BookRecommendationActivity.this.localbooklist != null) && (BookRecommendationActivity.this.localbooklist.size() != 0))
//        {
//          BookRecommendationActivity.this.myrunnable.setisload(true);
//          label107: BookRecommendationActivity.this.handler.post(BookRecommendationActivity.this.myrunnable);
//        }
//      }
//      while (true)
//      {
//        super.run();
//        return;
//        BookRecommendationActivity.this.hasmore = false;
//        BookRecommendationActivity.this.myrunnable.setisvisible(true);
//        break label107:
//        BookRecommendationActivity.this.myrunnable.setisvisible(true);
//        BookRecommendationActivity.this.handler.post(BookRecommendationActivity.this.myrunnable);
//      }
//    }
//	}
//
//	private class Myrunnable implements Runnable {
//		public boolean isload = false;
//		public boolean isvisible = false;
//
//		private void reset() {
//			this.isload = false;
//			this.isvisible = false;
//		}
//
//		public void run() {
//			if (this.isload)
//				BookRecommendationActivity.this.load();
//			if (this.isvisible) {
//				Toast.makeText(BookRecommendationActivity.this.context,
//						"已显示全部内容，请等待更新", 0).show();
//				BookRecommendationActivity.this.morebooks.setVisibility(8);
//			}
//			reset();
//			BookRecommendationActivity.this.thread2getnewbookisrunning = false;
//		}
//
//		public void setisload(boolean paramBoolean) {
//			this.isload = paramBoolean;
//		}
//
//		public void setisvisible(boolean paramBoolean) {
//			this.isvisible = paramBoolean;
//		}
//	}
//}